<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="FBGraph.Web.Mvc.FBGraphViewPage<IndexData>" %>

<asp:Content ID="t" ContentPlaceHolderID="TitleContent" runat="server">Photos and Albums Demo</asp:Content>

<asp:Content ID="c" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Photos and Albums Demo</h2>
    
    <div class="section">
        <h3>Albums</h3>
        
        <div class="content">
            <h4>Create a new album</h4>
            <% using (Html.BeginForm("create", "photos")) { %>
            <label for="name">Name: </label>
            <%= Html.TextBox("name", "FBGraph.NET Test Album") %>
            <input type="submit" value="Create" />
            <% } %>
        </div>
        
        <div class="content">
            <ul id="albums">
                <% foreach (var album in Model.Albums) { %>
                <li>
                    <a href="<%= Url.Action("album", new { id = album.Id }) %>">
                        <%= Html.Picture(album.Id, album.Name) %>
                        <span>
                            <%= album.Name %>
                            [<%= album.Count %>]
                        </span>
                    </a>
                    <p>
                        by <%= Html.ActionLink(album.From.Name, "detail", "profile", new { id = album.From.Id }, null) %>
                    </p>
                </li>
                <% } %>
            </ul>
            <br class="clear" />
        </div>
    </div>
    
    <div class="section">
        <h3>Photos</h3>
        
        <div class="content">
            <ul id="photos">
                <% foreach (var photo in Model.Photos) { %>
                <li>
                    <a href="<%= Url.Action("photo", new { id = photo.Id }) %>">
                        <img src="<%= photo.Picture %>" alt="<%= photo.Name %>" />
                        <span><%= photo.Name %></span>
                    </a>
                    <p>                
                        <% if (((FBGraph.Demos.AspNetMvc.Controllers.BaseController)this.ViewContext.Controller).CreatedIds.Contains(photo.Id.ToString())) { %>
                        [<%= Html.ActionLink("Delete", "delete", new { id = photo.Id }, new { onclick = "return confirm('This will really delete the photo. Are you sure?');" })%>]
                        <% } %>
                    </p>
                </li>
                <% } %>
            </ul>
            <br class="clear" />
        </div>
    </div>    

</asp:Content>
